package eclipse.client.forms;
import javax.swing.*;
import eclipse.lib.*;
import eclipse.util.*;
import eclipse.util.io.*;
public class NewAccount extends StandardForm 
{
	public static final long serialVersionUID = 1L;
	public JTextField 		txtUName;
	public JPasswordField 	txtPWord;
	public JPasswordField 	txtCWord;
	
	public NewAccount(String sTitle, int iXLoc, int iYLoc, ERL eImg) 
	{
		super(sTitle, iXLoc, iYLoc, eImg);
		initComponents();
	}
	private void initComponents()
	{
		int uNameX,		uNameY,		uNameW,		uNameH;
		int pWordX, 	pWordY, 	pWordW, 	pWordH;
		int cWordX,		cWordY,		cWordW,		cWordH;
		int formW,		formH;
		
		formW = this.getWidth();
		formH = this.getHeight();
		
		PropertyFile pFile = new PropertyFile(new ERL("jar://config").openStream());
		uNameX	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "UNAME", "X"));
		uNameY	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "UNAME", "Y"));
		uNameW	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "UNAME", "W"));
		uNameH	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "UNAME", "H"));
		
		pWordX	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "PWORD", "X"));
		pWordY	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "PWORD", "Y"));
		pWordW	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "PWORD", "W"));
		pWordH	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "PWORD", "H"));
		
		cWordX	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "CWORD", "X"));
		cWordY	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "CWORD", "Y"));
		cWordW	 = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "CWORD", "W"));
		cWordH   = Integer.parseInt(pFile.readProperty("NEWACCOUNT", "INPUT", "CWORD", "H"));
		
		txtUName = new JTextField();
		txtPWord = new JPasswordField();
		txtCWord = new JPasswordField();
		
		GroupLayout layout = new GroupLayout(getContentPane());
		
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(
			layout.createParallelGroup(GroupLayout.Alignment.LEADING)
			.addGroup(layout.createSequentialGroup()
				.addGap(uNameX, uNameX, uNameX)
				.addComponent(txtUName, uNameW, uNameW, uNameW)
				.addContainerGap(formW - (uNameX + uNameW + 17), Short.MAX_VALUE))
			.addGroup(layout.createSequentialGroup()
				.addGap(pWordX, pWordX, pWordX)
				.addComponent(txtPWord, pWordW, pWordW, pWordW)
				.addContainerGap(formW - (pWordX + pWordW + 17), Short.MAX_VALUE))
			.addGroup(layout.createSequentialGroup()
				.addGap(cWordX, cWordX, cWordX)
				.addComponent(txtCWord, cWordW, cWordW, cWordW)
				.addContainerGap(formW - (cWordX + cWordW + 17), Short.MAX_VALUE))				
		);
		layout.setVerticalGroup(
			layout.createParallelGroup(GroupLayout.Alignment.LEADING)
			.addGroup(layout.createSequentialGroup()
				.addGap(uNameY, uNameY, uNameY)
				.addComponent(txtUName, uNameH, uNameH, uNameH)
				.addContainerGap(formH - (uNameY + uNameH + 10), Short.MAX_VALUE))
			.addGroup(layout.createSequentialGroup()
				.addGap(pWordY, pWordY, pWordY)
				.addComponent(txtPWord, pWordH, pWordH, pWordH)
				.addContainerGap(formH - (pWordY + pWordH + 10), Short.MAX_VALUE))
			.addGroup(layout.createSequentialGroup()
				.addGap(cWordY, cWordY, cWordY)
				.addComponent(txtCWord, cWordH, cWordH, cWordH)
				.addContainerGap(formH - (cWordY + cWordH + 10), Short.MAX_VALUE))
		);		
		pack();
	}
	
}
